//
//  RegisterUserInfoController.swift
//  maopu
//
//  Created by huazi on 2017/5/1.
//  Copyright © 2017年 maopu. All rights reserved.
//

import UIKit

class RegisterUserInfoController: BaseViewController {
    fileprivate var btnPop: UIButton!
    fileprivate var btnUploadImage: UIButton!
    fileprivate var labelDes: UILabel!
    fileprivate var textFieldNick: UITextField!
    fileprivate var textFieldPwd: UITextField!
    fileprivate var textFieldSex: UITextField!
    fileprivate var textFieldBirthday: UITextField!
    fileprivate var btnComplete: UIButton!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.initView()
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */
    fileprivate func initView() {
        self.btnPop = UIButton.init(frame: CGRect.init(x: 0, y: 20, width: 44, height: 44))
        self.btnPop.setImage(UIImage.init(named: "back"), for: .normal)
        self.btnPop.addTarget(self, action: #selector(self.goBack), for: .touchUpInside)
        self.view.addSubview(self.btnPop)
        
        var top: CGFloat = 60.0
        let left: CGFloat = 15.0
        let btnUploadHeight: CGFloat = 80.0
        let btnHeight: CGFloat = 40.0
        
        self.btnUploadImage = UIButton.init(frame: CGRect.init(x: (AppWidth - btnUploadHeight)/2, y: top, width: btnUploadHeight, height: btnUploadHeight))
        self.btnUploadImage.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#dddddd")), for: .normal)
        self.btnUploadImage.setCircel()
        self.view.addSubview(self.btnUploadImage)
        top += btnUploadHeight + 20.0
        
        self.labelDes = UILabel.init(frame: CGRect.init(x: 0, y: top, width: AppWidth, height: 30))
        self.labelDes.text = "上传头像，做一个与众不同的猫扑er～"
        self.labelDes.textAlignment = .center
        self.labelDes.font = UIFont.LightDefaultFont(11.0)
        self.view.addSubview(self.labelDes)
        top += 30+20
        
        self.textFieldNick = UITextField.init(frame: CGRect.init(x: left, y: top, width: AppWidth-2*left, height: 40.0))
        self.textFieldNick.placeholder = "使用常用昵称，方便你的朋友找到你"
        self.textFieldNick.font = UIFont.LightDefaultFont(13.0)
        self.view.addSubview(self.textFieldNick)
        top += 40.0
        
        let viewLine: UIView = UIView.init(frame: CGRect.init(x: left, y: top , width: AppWidth - 2*left, height: 0.5))
        viewLine.backgroundColor = UIColor.gray
        self.view.addSubview(viewLine)
        
        self.textFieldPwd = UITextField.init(frame: CGRect.init(x: left, y: top, width: AppWidth-2*left, height: 40.0))
        self.textFieldPwd.placeholder = "请设置6～20位的密码"
        self.textFieldPwd.font = UIFont.LightDefaultFont(13.0)
        self.view.addSubview(self.textFieldPwd)
        top += 40.0
        
        let viewLine2: UIView = UIView.init(frame: CGRect.init(x: left, y: top , width: AppWidth - 2*left, height: 0.5))
        viewLine2.backgroundColor = UIColor.gray
        self.view.addSubview(viewLine2)
        
        self.textFieldSex = UITextField.init(frame: CGRect.init(x: left, y: top, width: AppWidth-2*left, height: 40.0))
        self.textFieldSex.placeholder = "性别"
        self.textFieldSex.font = UIFont.LightDefaultFont(13.0)
        self.view.addSubview(self.textFieldSex)
        top += 40.0
        
        let imageRightArrow = UIImageView.init(frame: CGRect.init(x:AppWidth - left - 7 , y:top - 40 + (40 - 12)/2, width: 7, height: 12))
        imageRightArrow.image = UIImage.init(named: "next_ico")
        self.view.addSubview(imageRightArrow)
        
        let viewLine3: UIView = UIView.init(frame: CGRect.init(x: left, y: top , width: AppWidth - 2*left, height: 0.5))
        viewLine3.backgroundColor = UIColor.gray
        self.view.addSubview(viewLine3)
        
        self.textFieldBirthday = UITextField.init(frame: CGRect.init(x: left, y: top, width: AppWidth-2*left, height: 40.0))
        self.textFieldBirthday.placeholder = "生日"
        self.textFieldBirthday.font = UIFont.LightDefaultFont(13.0)
        self.view.addSubview(self.textFieldBirthday)
        top += 40.0
        
        let imageRightArrow2 = UIImageView.init(frame: CGRect.init(x:AppWidth - left - 7 , y:top - 40 + (40 - 12)/2, width: 7, height: 12))
        imageRightArrow2.image = UIImage.init(named: "next_ico")
        self.view.addSubview(imageRightArrow2)
        
        let viewLine4: UIView = UIView.init(frame: CGRect.init(x: left, y: top , width: AppWidth - 2*left, height: 0.5))
        viewLine4.backgroundColor = UIColor.gray
        self.view.addSubview(viewLine4)
        top += 30.0
        
        self.btnComplete = UIButton.init(frame: CGRect.init(x: left, y: top, width: AppWidth-2*left, height: btnHeight))
        self.btnComplete.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#ffce54")), for: .normal)
        self.btnComplete.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#dcb34c")), for: .highlighted)
        self.btnComplete.setTitle("完成", for: .normal)
        self.btnComplete.setCornerRadius(radius: 20.0)
        self.btnComplete.titleLabel?.font = UIFont.LightDefaultFont(13.0)
        self.btnComplete.setTitleColor(UIColor.black, for: .normal)
        self.btnComplete.addTarget(self, action: #selector(btnCompleteClick), for: .touchUpInside)
        self.view.addSubview(self.btnComplete)
        
    }
    @objc fileprivate func btnCompleteClick(){
        _ = self.navigationController?.popToRootViewController(animated: true)
    }
}
